<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
    <div id="box">
        <input type="number" v-model="pre">
        <select v-model="hao">
            <option>+</option>
            <option>-</option>
            <option>*</option>
            <option>/</option>
            <option>%</option>
        </select>
        <input type="number" v-model="nex">=
        <span>{{num}}</span>
        <button v-on:click="over()">计算</button>
        <script>
            new Vue({
                el: "#box",
                data: {
                    pre: "",
                    nex: "",
                    num: "",
                    hao: ""
                },
                methods: {
                    over() {
                        this.num = eval(this.pre + `${this.hao}` + this.nex)
                    }
                }
            })
        </script>
    </div>
</body>

</html>